﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Stock.Client
{
      public partial class frmMessage : Form
      {
            public frmMessage()
            {
                  InitializeComponent();
            }

            string _msg = string.Empty;

            public frmMessage(string msg):this()
            {
                  _msg = msg;
            }

            private void frmMessage_Load(object sender, EventArgs e)
            {
                  this.lblMsg.Text = _msg;
                  System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
                  t.Interval = 2000;//2秒
                  t.Tick += new EventHandler(t_Tick);
                  t.Start();
            }

            void t_Tick(object sender, EventArgs e)
            {
                  ((System.Windows.Forms.Timer)sender).Stop();
                  this.Close();
                  this.Dispose();
            }

            private void frmMessage_Click(object sender, EventArgs e)
            {
                  this.Close();
                  this.Dispose();
            }
      }
}
